package com.androidx.p013lv.base.http;

import android.text.TextUtils;
import android.util.Log;
import com.androidx.p013lv.base.utils.UiUtils;
import org.json.JSONException;
import org.json.JSONObject;

/* renamed from: com.androidx.lv.base.http.JsonParams */
public class JsonParams {
    private static JsonParams helper;
    private static JSONObject jsonObject;

    public static JsonParams build() {
        if (helper == null) {
            helper = new JsonParams();
        }
        jsonObject = new JSONObject();
        return helper;
    }

    public final JsonParams add(String str, Object obj) {
        try {
            jsonObject.put(str, obj);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return this;
    }

    public final JSONObject commit() {
        return jsonObject;
    }

    public JSONObject travelerLogin(String str, String str2) {
        add("deviceId", str);
        if (str2 != null) {
            add("code", str2);
        }
        String channel = UiUtils.getChannel();
        Log.e("渠道号：", "-------------->" + channel);
        if (!TextUtils.isEmpty(channel) && !channel.equals(UiUtils.getMetaType())) {
            add("chCode", channel);
            Log.e("渠道号：", "chCode-------------->" + channel);
        }
        return commit();
    }
}
